using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

namespace MishraReader
{
    [ContractClass(typeof(ILightWeakEventManagerContract))]
    public interface ILightWeakEventManager
    {
        void Register<T>(object message, Action<T> callback);
        void Register(object message, Action callback);
        void Send(object message);
        void Send(object message, object parameter);
        void Unregister(object message, Action callback);
        void Unregister<T>(object message, Action<T> callback);
    }

    [ContractClassFor(typeof(ILightWeakEventManager))]
    internal abstract class ILightWeakEventManagerContract : ILightWeakEventManager
    {
        public void Register<T>(object message, Action<T> callback)
        {
            Contract.Requires<ArgumentNullException>(callback != null, "callback");
            Contract.Requires<ArgumentNullException>(message != null, "message");
        }

        public void Register(object message, Action callback)
        {
            Contract.Requires<ArgumentNullException>(callback != null, "callback");
            Contract.Requires<ArgumentNullException>(message != null, "message");
        }

        public void Send(object message)
        {
            Contract.Requires<ArgumentNullException>(message != null, "message");
        }

        public void Send(object message, object parameter)
        {
            Contract.Requires<ArgumentNullException>(message != null, "message");
        }

        public void Unregister(object message, Action callback)
        {
            Contract.Requires<ArgumentNullException>(callback != null, "callback");
            Contract.Requires<ArgumentNullException>(message != null, "message");
        }

        public void Unregister<T>(object message, Action<T> callback)
        {
            Contract.Requires<ArgumentNullException>(callback != null, "callback");
            Contract.Requires<ArgumentNullException>(message != null, "message");
        }
    }
}